﻿<Window x:Class="LaunchMeNot.WinAddEntry"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:l49="clr-namespace:Lime49;assembly=Lime49"
    xmlns:lex="http://schemas.root-project.org/xaml/presentation"
    xmlns:l49ui="clr-namespace:Lime49.UI;assembly=Lime49" 
    xmlns:conv="clr-namespace:LaunchMeNot.Converters" 
    l49:WindowService.EscapeClosesWindow="True"
    Title="{lex:LocText LaunchMeNot.Core:Strings:NewEntry}"
    MinHeight="80" MinWidth="250" Height="300" Width="400"
    FocusManager.FocusedElement="{Binding ElementName=txtName}"
    WindowStartupLocation="CenterOwner" x:Name="root" SizeToContent="Height"
    Style="{StaticResource {x:Type Window}}" Icon="pack://application:,,,/Resources/icon.ico">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Close" Executed="CloseWindow"/>
        <CommandBinding Command="ApplicationCommands.Open" Executed="Browse"/>
        <CommandBinding Command="ApplicationCommands.Save" Executed="SaveEntry"/>
    </Window.CommandBindings>
    <Window.Resources>
        
    </Window.Resources>
    <Grid Margin="6">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        
        <Label Grid.Row="0" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:Name}" />
        <TextBox x:Name="txtName" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" TabIndex="1" Text="{Binding SelectedEntry.Name,ElementName=root,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
        
        <Label Grid.Row="1" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:Path}" />
        <TextBox x:Name="txtPath" Grid.Row="1" Grid.Column="1" TabIndex="2" Text="{Binding SelectedEntry.Path,ElementName=root,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                 ToolTip="The path to the application to start"/>
        <Button x:Name="btnBrowse" Grid.Row="1" Grid.Column="2" TabIndex="3" MinWidth="70" Command="ApplicationCommands.Open" Content="{lex:LocText LaunchMeNot.Core:Strings:Browse}" />
        
        <Label Grid.Row="2" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:Arguments}"  />
        <TextBox x:Name="txtArguments" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" TabIndex="4" Text="{Binding SelectedEntry.Arguments,ElementName=root,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                 ToolTip="The path to the application to start"/>
        
        <Label x:Name="lblDescription" Grid.Row="3" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:Description}" />
        <TextBox x:Name="txtDescription" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" TabIndex="5" Text="{Binding SelectedEntry.Description,ElementName=root,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
        
        <Label Grid.Row="4" Grid.Column="0" x:Name="lblEntryType" Content="{lex:LocText LaunchMeNot.Core:Strings:Location}" />
        <ComboBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" x:Name="cboEntryType" TabIndex="6" SelectionChanged="cboEntryType_SelectionChanged" 
                  DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding SelectedEntry.EntryType,ElementName=root,Mode=OneWay}" ToolTip="{lex:LocText LaunchMeNot.Core:Strings:HowShouldEntryBeLaunched}"/>
        
        <Label x:Name="lblDelay" Grid.Row="5" Grid.Column="0" Content="{lex:LocText LaunchMeNot.Core:Strings:TimeToWait}"  />
        <l49ui:MaskedTextBox x:Name="txtDelay" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" TabIndex="7" Width="80" HorizontalAlignment="Left" Type="DigitsWithDecimalPoint" Text="{Binding SelectedEntry.LaunchDelay,ElementName=root,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                 ToolTip="{lex:LocText LaunchMeNot.Core:Strings:TimeToWaitDesc}"/>
        <CheckBox x:Name="chkIsEnabled" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" TabIndex="8" Content="Enabled" IsChecked="{Binding SelectedEntry.IsEnabled,ElementName=root,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
        
        <StackPanel Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button x:Name="btnOk" MinWidth="70" IsDefault="True" Command="ApplicationCommands.Save" Content="{lex:LocText LaunchMeNot.Core:Strings:Add}"/>
            <Button x:Name="btnCancel" MinWidth="70" IsCancel="True" Command="ApplicationCommands.Close" Margin="2,2,0,2" Content="{lex:LocText LaunchMeNot.Core:Strings:Cancel}"/>
        </StackPanel>
    </Grid>
</Window>
